package common.tests 
{
	import common.AbstractTest;
	import common.ITest;
	import common.ITestResult;
	import common.SummaryTestResult;
	
	/**
	 * ...
	 * @author Luke Van In
	 */
	public class MethodTest extends AbstractTest implements ITest 
	{
		
		private var _description:String;
		
		private var _method:Function;
		
		private var _parameters:Array;
		
		
		
		public function MethodTest(description:String, method:Function, parameters:Array = null) 
		{
			super(description);
			
			this._method = method;
			
			this._parameters = parameters;
		}
		
		
		public function run():ITestResult 
		{
			var result:ITestResult = this._method.apply(null, this._parameters) as ITestResult;

			var summary:ITestResult = new (result, this.getDescription());
			
			return summary;
		}
		
	}

}